var xmlhttp

$(document).ready(function(){
    xmlhttp = GetXmlHttpObject();
    //functions to execute on page ready here
});

function GetXmlHttpObject(){
    if(window.XMLHttpRequest){
        return new XMLHttpRequest();
    }
    if (window.ActiveXObject){
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    alert("Your browser does not support AJAX!")
    return null;
}

function loadPageContent(){
    var url = '../cmsadmin/controller/includes/loadPageContent.php';
    //attach a variable to the url
    url = url + '?q=' + 'pagename';
    //add random number to not use cached file
    url = url + '&sid=' + Math.random();

    //execute php script
    xmlhttp.open('GET', url, true);
    xmlhttp.send(null);

    //change html content here
    $('#content').html(xmlhttp.responseText);
}

function loadImageGallery(){
    var url = '../cmsadmin/controller/includes/loadImageGallery.php';

    //attach a variable to the url
    url = url + '?q=' + 'galleryname';
    //add random number to not use cached file
    url = url + '&sid=' + Math.random();

    //execute php script
    xmlhttp.open('GET', url, true);
    xmlhttp.send(null);

    //change html content here
    $('#gallery').html(xmlhttp.responseText);
}
